<style lang="less">
  @import './login.less';
  .button-new {
    margin-top: 30px;
    width: 280px;
    border-radius: 40px;
  }
  input:-webkit-autofill , textarea:-webkit-autofill, select:-webkit-autofill {
    -webkit-text-fill-color: black !important;
    -webkit-box-shadow: 0 0 0px 1000px transparent  inset !important;
    background-color:transparent;
    background-image: none;
    transition: background-color 50000s ease-in-out 0s; //背景色透明  生效时长  过渡效果  启用时延迟的时间
  }
  input {
    background-color: transparent;
    outline:none
  }
  .login > .ivu-card-body {
    padding: 16px;
    background-color: #f2f2f2;
  }
  .ivu-card-body {
    padding: 16px;
  }
  .ivu-input-group > .ivu-input:last-child, .ivu-input-group-append {
    border-bottom-left-radius: 0 !important;
    border-top-left-radius: 0 !important;
    border-top-style: none;
    border-right-style: none;
    border-left-style: none;
    border-bottom-style: none;
    border-bottom: #999 1px solid;
    background-color: transparent;
    border-radius: 0px;
    height: 60px;
    font-size: 20px;
  }
  input:focus{
    outline: none;
  }
  .ivu-input-group-prepend, .ivu-input-group-append {
    padding: 4px 7px;
    font-size: inherit;
    font-weight: normal;
    line-height: 1;
    color: #515a6e;
    text-align: center;
    background-color: #f2f2f2;
    /* border: 1px solid #dcdee2; */
    border-radius: 0px;
    border-bottom: 1px solid #999;
    border-top-style: none;
    border-right-style: none;
    border-left-style: none;
  }
    //-----下面样式 为了适配 疫情系统
    .login /deep/ .ivu-card{
        background: none;
    }
    .login /deep/ .ivu-input-group-prepend, .ivu-input-group-append{
        background: none;
        color: black;
    }
    .login /deep/ .ivu-form-item-error .ivu-input-group-prepend, .ivu-form-item-error .ivu-input-group-append{
        border: none;
    }
  .login /deep/ .ivu-input-group > .ivu-input:last-child, .ivu-input-group-append{
      color: black;
  }
</style>

<template>
  <div class="login" v-if="is_show">
    <div class="login-con" style="top: 40%;right:70px;width:400px;">
      <Card icon="log-in" title="" :bordered="false" style="margin-left: 16%;margin-top: 15%;">
        <div class="form-con">
          <login-form @on-success-valid="handleSubmit"></login-form>
<!--          <p class="login-tip">输入任意用户名和密码即可</p>-->
        </div>
      </Card>
    </div>
  </div>
</template>

<script>
import LoginForm from '_c/login-form'
import { mapActions } from 'vuex'
import Gmk from '@/view/login/Gmk.vue'
export default {
  data () {
    return {
      is_show: false,
      data: {
        userName: '',
        password: ''
      }
    }
  },
  components: {
    LoginForm
  },
  mounted (option) {
    console.log(this.$route.query.username, '12222')
    if (this.$route.query.username) {
      this.handleSubmit({ userName: this.$route.query.username, password: '000000' })
    } else {
      this.is_show = true
    }
  },
  methods: {
    ...mapActions([
      'handleLogin',
      'getUserInfo'
    ]),
    handleSubmit ({ userName, password }) {
      console.log('登录')
      this.handleLogin({ userName, password }).then(res => {
        if (res.errcode === 0) {
          if (res.data.errcode === 0) {
            // this.$Message.success('登录成功')
            this.getUserInfo().then(resx => {
              console.log(resx, this.$config.homeName, '用户信息')
              Gmk.userName = userName
              Gmk.password = password
              this.$router.push({
                name: this.$config.homeName
              })
            })
          } else {
            this.$Message.error(res.data.errmsg)
          }
        } else {
          this.$Message.error(res.errmsg)
        }
      })
    }
  }
}
</script>

<style>

</style>
